<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Admin - Bootstrap Admin Template</title>

    <link href="__PUBLIC__/home/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/home/css/alert.css" rel="stylesheet">

    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>

</head>
<body>
<div class="container-fluid">
    <form class="form-inline" action="{:U('Member/index')}" method="post">
        <button type="button" class="btn btn-sm btn-primary btn-close" id="xx-btn-index">员工列表</button>
        <button type="button" class="btn btn-sm btn-default btn-close" id="xx-btn-add">添加员工</button>
    </form>

    <div class="row">
    <div class="tab-content col-xs-12">
        <div role="tabpanel" class="tab-pane active" id="message">
            <div class="row">
                <div class="col-sm-10">
                    <form id="zyn-form-add" class="form-horizontal" action="{:U('Member/insert')}" method="post">
                        <div class="form-group">
                            <label for="lc-input-user_name" class="control-label col-sm-2">员工姓名</label>
                            <div class="col-sm-3">
                                <input id="lc-input-user_name" class="form-control" required type="text" name="real_name" value=""/>
                            </div>
                            <div class="col-sm-3">
                                <p class="lc-p-validate-result p-no-margin" attr-validate = "device_name">*员工姓名</p>
                            </div>
                        </div>
                        <!--<div class="form-group">-->
                            <!--<label for="lc-input-password" class="control-label col-sm-2">密码</label>-->
                            <!--<div class="col-sm-3">-->
                                <!--<input id="lc-input-password" class="form-control"  required type="password" name="password" value=""/>-->
                            <!--</div>-->
                            <!--<div class="col-sm-3">-->
                                <!--<p class="lc-p-validate-result p-no-margin" attr-validate = "url">*员工登陆密码</p>-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<div class="form-group">-->
                            <!--<label for="lc-input-password" class="control-label col-sm-2">确认密码</label>-->
                            <!--<div class="col-sm-3">-->
                                <!--<input id="lc-input-confirm_password" required class="form-control" type="password" name="confirm_password" value=""/>-->
                            <!--</div>-->
                            <!--<div class="col-sm-3">-->
                                <!--<p class="lc-p-validate-result p-no-margin" attr-validate = "url">*确认密码</p>-->
                            <!--</div>-->
                        <!--</div>-->
                        <div class="form-group">
                            <label for="lc-input-phone_mob" class="control-label col-sm-2">手机号</label>
                            <div class="col-sm-3">
                                <input id="lc-input-phone_mob" class="form-control" type="text" name="phone_mob" value="" required/>
                            </div>
                            <div class="col-sm-3">
                                <p class="lc-p-validate-result p-no-margin" attr-validate = "phone_mob">*手机号</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lc-input-email" class="control-label col-sm-2">邮箱</label>
                            <div class="col-sm-3">
                                <input id="lc-input-email" class="form-control" type="text" name="email" value=""/>
                            </div>
                            <div class="col-sm-3">
                                <p class="lc-p-validate-result p-no-margin" attr-validate = "email">邮箱</p>
                            </div>
                        </div>
                        <if condition="$info['is_main'] eq 1">
                            <div class="form-group" id="parent">
                                <label class="control-label col-sm-2">选择店铺</label>
                                <div class="col-sm-3">
                                    <select class="p-no-margin form-control" name="store_id" style="width: auto;" id="store_select">
                                        <option value="0">请选择店铺</option>
                                        <volist name="storeList" id="re">
                                            <option value="{$re.store_id}">{$re.store_name}</option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                            <else/>
                            <input type="hidden" name="store_id" value="{$info['store_id']}">
                        </if>
                        <div class="form-group">
                            <label class="control-label col-sm-2">选择部门</label>
                            <div class="col-sm-3">
                                <select class="p-no-margin form-control" name="department_id" style="width: auto;" id="department_select">
                                    <option value="0">请选择部门</option>
                                    <volist name="list" id="re">
                                        <option value="{$re.department_id}">{$re.department_name}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>

                        <div class="col-xs-10 col-xs-offset-2">
                            <button class="btn btn-primary" id="lc-btn-save" type="submit">提交保存</button>
                            <a class="btn btn-primary" href="javascript:history.back(-1)">返回上一页</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<include file = "Public/html/footer.html" />
<script>
    $("#lc-btn-return").click(function () {
        location.href = "{:U('Store/index')}";
    })
    $("#xx-btn-add").click(function () {
        location.href = "{:U('Member/insert')}";
    })
    $("#xx-btn-index").click(function(){
        location.href = "{:U('Member/index')}";
    })

    $("#store_select").change(function(){
        var store_id = $(this).val();
        var html = '';
        if(store_id == 0){
            html += '<option value="0">请选择部门</option>';
            $("#department_select").html(html);
            return false;
        }else{
            var url = "{:U('Member/getDepartmentList')}";
            $.post(url,{
                store_id:store_id
            },function(data){
                html += '<option value="0">请选择部门</option>';
                var res = JSON.parse(data);
                if(res.code == 1){
                    $.each(res.data,function(index,item){
                        html += "<option value='"+item.department_id+"'>"+item.department_name+"</option>";
                    })
                }
                $("#department_select").html(html);
            })
        }
    })
</script>
</body>
</html>
